Running Macintosh Programs Under A/UX
Running Macintosh Programs Under A/UX
A/UX is Apple's version of the UNIX operating system, which provides a
multitasking and multi-user environment in which users can run applications.
One of the most distinctive features of A/UX in comparison with other
implementations of the UNIX operating system is its ability to run conforming
Macintosh applications. Within limits described below, applications developed
for the Macintosh Operating System using the standard Macintosh
User Interface Toolbox routines will execute under A/UX.
The ability to run Macintosh applications under A/UX is provided by
enhancements to the A/UX kernel and by a library of functions known as the
A/UX Toolbox. The A/UX Toolbox is a library of routines that enables a
program running under A/UX to call Macintosh Toolbox routines and native
Macintosh Operating System routines. The A/UX Toolbox provides a bridge
between the Macintosh and A/UX environments, giving you two kinds of code
compatibility:
You can execute Macintosh binary code ( applications compiled in the
Macintosh environment) under A/UX, within the current limitations of
the A/UX Toolbox.
You can write common source code that can be separately built (that
is, compiled and linked) into executable code for both environments.
The A/UX Toolbox operates trans parently to the user and to applications. This
means that (subject once again to qualifications detailed later) your
applications developed for the Macintosh Operating System should execute
under the A/UX operating system.
This section briefly explains how the A/UX Toolbox works and then provides
details on writing Macintosh applications that execute under the A/UX
operating system. A/UX provides such a high level of compatibility with
Macintosh applications that your existing application may very well run under
A/UX with no changes whatsoever. In general, if your application conforms to
the interfaces documented in Inside Macintosh, is MultiFinder-aware, does not
rely on low-memory global variables, and heeds the various guidelines
presented in About Compatibility, it should operate under A/UX.
How the A/UX Toolbox Works
The primary function of the A/UX Toolbox is to make available to programs
running under A/UX the standard Macintosh support code described in Inside
Macintosh. Most of the support code consists of routines built into the
Macintosh ROM.
The ROM routines fall into two categories, User Interface Toolbox
routines and Macintosh Operating System routines. The A/UX Toolbox uses one
of two strategies for supporting a call to a Macintosh ROM routine, depending
on whether the call is to the User Interface Toolbox or to the native
Macintosh Operating System.
When an A/UX Toolbox application calls one of the Macintosh
User Interface Toolbox routines, the A/UX Toolbox intercepts the call
and, if necessary, translates the parameters into a form usable by the ROM.
After the A/UX Toolbox performs the translation, it invokes the ROM code that
would be used in the native Macintosh environment.
When an A/UX Toolbox application calls one of the Macintosh Operating
System routines, the A/UX Toolbox diverts the call to a substitute routine in
its own library. The A/UX Toolbox Operating System routines call the standard
A/UX libraries to perform the A/UX equivalents of the Macintosh Operating
System functions. The Macintosh Operating System ROM code is never used
under A/UX. Note that some of the built-in
User Interface Toolbox routines generate calls to the Macintosh Operating
System routines; these calls are also intercepted by the A/UX Toolbox and
diverted to routines in its own library.
The Figure below illustrates how the two elements of the A/UX Toolbox
library interact with the application and the ROM code.
Interactions among an application, the A/UX Toolbox, and ROM code
Using the A/UX Toolbox
The primary limitation on Macintosh applications running under A/UX is that
the A/UX Toolbox does not currently support all managers and drivers. The
Table below summarizes the status of various ROM libraries in A/UX Release
2.0. Note that "Full" support for a manager or driver means that the version of
that manager released with system software 6.0.5 is available. In particular,
there is currently no support under A/UX for any of the new features
introduced in system 7.0.
Status of User Interface Toolbox and Macintosh Operating System
libraries in the A/UX Toolbox
ROM library Implementation
Alias Manager None
Binary-Decimal Conversion Package Full
Color Manager Full
Color Picker Package Full
Color QuickDraw Full
Control Manager Full
Data Access Manager None
Deferred Task Manager None
Desk Manager Full
Device Manager Full
Dialog Manager Full
Disk Driver Full
Disk Initialization Package Full
Edition Manager None
Event Manager Operating System Partial
Event Manager Toolbox Full*
File Manager Full
Floating-Point Arithmetic and
Transcendental Functions Packages Full*
Font Manager Full
Gestalt Manager Full
Help Manager None
International Utilities Package Full
List Manager Full
Memory Manager Full
Menu Manager Full
Notification Manager Full
Package Manager Full
Palette Manager Full
Power Manager None
Printing Manager Full
Resource Manager Full
Scrap Manager Full
Script Manager Full
Segment Loader Partial
Serial Drivers Full
Slot Manager Full
Sound Manager Full
Standard File Package Full
Startup Manager Full
System Error Handler Full*
Time Manager Full*
Utilities, Operating System Utilities Partial
Utilities, Toolbox Utilities Full
Vert. Retrace Mgr Partial
Window Manager Full
Note: When A/UX implements a particular manager or driver, the version of
that manager or driver may not be the same as the version available in the
Macintosh Operating System. This means that, whenever possible, you should
use Gestalt to check for the existence of the particular features your
application needs. In managers or drivers marked with an asterisk (*), all
routines are implemented under A/UX, but the behavior is not identical to that
in the Macintosh Operating System. See the publication A/UX Toolbox:
Macintosh ROM Interface for complete details on the implementation of these
managers and drivers.
A/UX Compatibility Guidelines
The A/UX Toolbox has been designed to allow as many Macintosh applications
as possible to execute under the A/UX operating system. Because of pro found
differences between the two environments, however, it is possible that some
applications may not execute correctly under A/UX. By following these
guidelines, you can help ensure that your Macintosh applications run under
A/UX.
Make certain that your application is MultiFinder-friendly.
MultiFinder is a standard part of A/UX, just as it is in system 7.0
(where the Finder and the
Process Manager provide the cooperative multitasking
environment). Your application should include a 'SIZE' resource and
call the WaitNextEvent function in its main event loop. Note that the
version of MultiFinder included with A/UX Release 2.0 is functionally
equivalent to the version of MultiFinder released with system software
system 6.0.5, but it has been customized for use under A/UX.
Always use the available managers and drivers to manipulate
hardware devices. In the Macintosh Operating System, individual
processes and the various libraries can have much more control over
the system than under A/UX, where the kernel manages all interaction
between processes and the underlying hardware. In particular, do not
attempt to read data from or write data to any of the memory-mapped
hardware available on a Macintosh computer.
Avoid relying on the low-memory global variables. Not all of them are
available under A/UX.
Make certain that your application is 32-bit clean (that is, it
operates in an environment where all 32 bits of a handle or pointer are
significant in determining memory addresses).
Use the Gestalt Manager to determine which versions of managers
and drivers are present in the current operating environment before
relying on features that are not common to all released versions.
Generally, the versions of managers available under A/UX Release 2.0
are the same as those versions included in Macintosh system software
system 6.0.5.
Finally, your application should conform to the programming interfaces
described here and should follow the basic compatibility guidelines presented
in About Compatibility . For further details on running Macintosh
applications under A/UX, see A/UX Toolbox: Macintosh ROM Interface.